<?php

abstract class veiculosDAOImpl {

    public static function Featured($id,$value) {
        if (DB::$mysqli = DB::Connection()) {
            $query = "update vehicles set featured = ? where id=?";
            DB::$_stmt = DB::$mysqli->prepare($query);
            DB::$_stmt->bind_param('ii',$value,$id);
            DB::$_stmt->execute();
            return DB::$_stmt;
        } else {
            error_log("erro ao conectar!");
        }
    }

    public static function VerifyFeatured($id) {
        if (DB::$mysqli = DB::Connection()) {
            $query = "Select featured from vehicles where id=? and featured=1";
            DB::$_stmt = DB::$mysqli->prepare($query);
            DB::$_stmt->bind_param('i', $id);
            DB::$_stmt->execute();
            DB::$_stmt->bind_result($data_id);
            while (DB::$_stmt->fetch()) {
                $data[] = array(
                    'id' => $data_id,
                );
            }
            return $data;
        } else {
            error_log("erro ao conectar!");
        }
    }

}

?>
